<script setup lang="ts">
import UnlearnTask from '../../assets/unlearn_task.png';
import LearnTask from '../../assets/learn_task.png';


function getIcon(learn:Boolean){
  if(learn){
    return UnlearnTask;
  }else{
    return LearnTask;
  }
}



const props = defineProps(['data'])
</script>

<template>
  <div style="display: flex;flex-wrap: wrap; margin-top: 20px;  gap: 20px;">
  <div class="mainStyle" v-for="(element,_index) in props.data">
    <div class="rowLineStyle" style="align-items: center">
      <img :src="getIcon(element.learned)">
      <div style="font-size: 20px;display: flex;justify-content: center;text-align: left;margin-left: 6px">
        {{element.content}}
      </div>
    </div>

    <div class="rowLineStyle" style="margin-top: 10px;text-align: center;align-items: center;">
      <img width="16px" height="16px" src="../../assets/unlearn_courseware.png">
      <span style="color: blue;">3</span>个课件
      <img width="16px" height="16px" src="../../assets/unlearn_studyTimer.png" style="margin-left: 20px">
      <span style="color: green;">15</span>分钟
      <img width="16px" height="16px" src="../../assets/learn_timer.png" style="margin-left: 20px">
      <span style="color: orange;">2</span>学时
    </div>
    <div style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;margin-top: 20px">
      设备认知
      <el-button :class="{'custom-button':element.learned}" :disabled="element.learned"  type="primary" style="font-size: 16px;display: flex;flex-directionfont-weight: bold;">去考试</el-button>
    </div>
    </div>
  </div>
</template>

<style scoped>
.mainStyle{
  display: flex;
  flex-direction: column;
  background: url('../../assets/line_small_frame.png'),
  linear-gradient(#FFF2E4 100%, #FFF2E4 100%);
  cursor: pointer;/*鼠标移动上去是手型*/
  background-size: cover; /* 让背景图片覆盖整个容器 */
  background-position: center; /* 居中背景图片 */
  background-repeat: no-repeat; /* 不重复背景图片 */
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #FFF2E4;
  width: 312px;
}
.rowLineStyle{
  display: flex;
  flex-direction: row;
}
.el-button--primary{
  --el-button-bg-color:#F08153;
  --el-button-hover-bg-color:#F08153;
  --el-button-border-color:#F08153;
}

  .custom-button {
  background: linear-gradient(to right, #AEAEAE, #737373) !important;
  border: none !important; /* 去除按钮边框 */
  color: white !important; /* 按钮文字颜色 */
  margin-top: 0;
}

</style>